function versionSort(verArr) {
  if (verArr.length <= 1) return verArr
  let midIndex = Math.floor(verArr.length / 2)
  let midVal = verArr.splice(midIndex, 1)[0]
  let left = []
  let right = []
  for (let i = 0; i < verArr.length; i++) {
    if (!isLeftMoreThanRight(verArr[i], midVal)) {
      right.push(verArr[i])
    } else {
      left.push(verArr[i])
    }
  } 
  return [...versionSort(left), midVal, ...versionSort(right)]
}

function isLeftMoreThanRight(leftVer, rightVer) {
  let L = leftVer.split('.')
  let R = rightVer.split('.')
  let i = 0
  let j = 0
  while (i < L.length && j < R.length) {
    if (L[i] < R[j]) return false
    else if (L[i] > R[j]) return true
    i++
    j++
  }
  return i < L.length
}

let newVer = versionSort(['0.1.1', '2.3.3', '0.302.1', '4.2', '4.3.5', '4.3.4.5'])
console.log(newVer);